<html dir="ltr" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:xlink="http://www.w3.org/1999/xlink">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta name="save" content="history" />
    <xml>
      <MSHelp:TOCTitle Title="Connecting to the Service" />
      <MSHelp:RLTitle Title="Connecting to the Service" />
      <MSHelp:Attr Name="DocSet" Value="docSet" />
      <MSHelp:Attr Name="TopicType" Value="kbOrient" />
      <MSHelp:Attr Name="Locale" Value="kbEnglish" />
      <MSHelp:Attr Name="AssetId" Value="{GUID}" />
    </xml>
    <title>Connecting to the Service</title>
    <link rel="stylesheet" type="text/css" href="../local/Classic.css" />
    <script src="../local/EventUtilities.js" type="text/javascript" language="jscript"> </script>
    <script src="../local/SplitScreen.js" type="text/javascript" language="jscript"> </script>
    <script src="../local/Dropdown.js" type="text/javascript" language="jscript"> </script>
    <script src="../local/script.js" type="text/javascript" language="jscript"> </script>
  </head>
  <body>
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" alt="DropDown image" src="../local/drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" alt="DropDownHover image" src="../local/drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" alt="Collapse image" src="../local/collapse_all.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" alt="Expand image" src="../local/expand_all.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" alt="CollapseAll image" src="../local/collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" alt="ExpandAll image" src="../local/expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" alt="Copy image" src="../local/copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" alt="CopyHover image" src="../local/copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">OData Service for Team Foundation Server 2010 (Beta)</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">Connecting to the Service</span>
          </td>
        </tr>
        <tr id="headerTableRow3">
          <td />
        </tr>
      </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0" style="cursor:default;display:none;">
              <img id="toggleAllImage" class="toggleAll" alt="CollapseAll image" src="../local/collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">Collapse All</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">Expand All</label> </span>
            <span id="languageFilterToolTip" onmouseover="languageFilterImage.src=dropDownHoverImage.src;" onmouseout="languageFilterImage.src=dropDownImage.src;" tabindex="0" style="cursor:default;">
              <img id="languageFilterImage" alt="DropDown image" src="../local/drpdown.gif" />
              <label id="showAllLabel" for="languageFilterImage" style="display: none;">Language Filter: All</label>
              <label id="multipleLabel" for="languageFilterImage" style="display: none;">Language Filter: Multiple</label>
              <label id="vbLabel" for="languageFilterImage" style="display: none;">Language Filter: Visual Basic</label>
              <label id="csLabel" for="languageFilterImage" style="display: none;">Language Filter: C#</label>
            </span>
          </td>
        </tr>
      </table>
      <div id="languageSpan">
        <input type="checkbox" name="languageFilter" onclick="SetLanguage(this)" id="vbUsageCheckbox" />
        <label class="languageFilter" for="vbUsageCheckbox">Visual Basic Usage</label>
        <br />
        <input type="checkbox" name="languageFilter" onclick="SetLanguage(this)" id="csCheckbox" />
        <label class="languageFilter" for="csCheckbox">C#</label>
        <br />
      </div>
    </div>
    <div id="mainSection">
      <div id="mainBody">
        <div id="allHistory" class="saveHistory" onsave="saveAll()" onload="loadAll()" />
        <p>After running the setup script, navigate to the <b>code</b> folder, open the <b>ODataTFS.sln</b> solution in Visual Studio 2010 and press <b>F5</b>. The OData Service for TFS will be available through a secure HTTPS connection at <a href="https://127.0.0.1/">https://127.0.0.1</a>.</p>
        <a name="_Toc290470866" href="#">
          <span />
        </a>
        <h3 class="subheading">From a Web Browser</h3>
        <p>When you access the service from a web browser, you will be prompted for your TFS credentials (domain, username and password).</p>
        <p>
          <img src="images\5d5b1316-4344-4616-a6cd-40f08482a67c.png" />
        </p>
        <br />
        <a name="_Toc290470867" href="#">
          <span />
        </a>
        <h3 class="subheading">From a Client Application</h3>
        <p>The OData Service for TFS expects a HTTP Basic Authentication header with the TFS credentials. This header can be added programmatically from a client application using the code snippet shown below:</p>
        <div class="code">
          <span codeLanguage="CSharp">
            <table width="100%" cellspacing="0" cellpadding="0">
              <tr>
                <th>C#</th>
                <th>
                  <span class="copyCode" onclick="CopyCode(this)" onkeypress="CopyCode_CheckKey(this)" onmouseover="ChangeCopyCodeIcon(this)" onfocusin="ChangeCopyCodeIcon(this)" onmouseout="ChangeCopyCodeIcon(this)" onfocusout="ChangeCopyCodeIcon(this)" tabindex="0">
                    <img class="copyCodeImage" name="ccImage" align="absmiddle" src="../local/copycode.gif" />Copy Code
                  </span>
                </th>
              </tr>
              <tr>
                <td colspan="2">
                  <pre><b>var proxy = new TFSData(new Uri("https://codeplexodata.cloudapp.net"));</b><b>proxy.SendingRequest += (s, e) =&gt;</b><b>{</b><b>   var credentials = string.Format(CultureInfo.InvariantCulture, @"{0}\{1}:{2}",</b><b>                         "sampleTfsDomain", "sampleTfsUser", "sampleTfsPassword");</b><b>   e.RequestHeaders.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(credentials)));</b><b>}</b></pre>
                </td>
              </tr>
            </table>
          </span>
        </div>
        <br />
        <p>If you are using a not trusted SSL certificate for the OData Service for TFS, then you will need to add the following line of code in your client application.</p>
        <div class="code">
          <span codeLanguage="CSharp">
            <table width="100%" cellspacing="0" cellpadding="0">
              <tr>
                <th>C#</th>
                <th>
                  <span class="copyCode" onclick="CopyCode(this)" onkeypress="CopyCode_CheckKey(this)" onmouseover="ChangeCopyCodeIcon(this)" onfocusin="ChangeCopyCodeIcon(this)" onmouseout="ChangeCopyCodeIcon(this)" onfocusout="ChangeCopyCodeIcon(this)" tabindex="0">
                    <img class="copyCodeImage" name="ccImage" align="absmiddle" src="../local/copycode.gif" />Copy Code
                  </span>
                </th>
              </tr>
              <tr>
                <td colspan="2">
                  <pre><b>System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) =&gt; { return true; };</b></pre>
                </td>
              </tr>
            </table>
          </span>
        </div>
        <br />
        <h1 class="heading">Next Step</h1>
        <p>
          <a href="docSet_0fc6c25f-59ca-4f8a-961c-5624c80a5ff2.html">Service Operations</a>
        </p>
        <br />
      </div>
      <div id="footer">
        <div class="footerLine">
          <img src="../local/footer.gif" alt="Footer image" width="100%" height="3px" />
        </div>
    To give feedback.
  <p />Copyright © 2011 by Microsoft Corporation. All rights reserved.</div>
    </div>
  </body>
</html>